package com.gof.example.visitor;

/**
 * Created with IntelliJ IDEA.
 * Created by zhiyuan on 2018/5/11 17:49.
 * haiming.fei@tongdun.cn
 */
public abstract class Schooler {

    private int papers;
    private int score;
    private String fullName;

    public Schooler() {
        this(1, 70, "unknown");
    }

    public Schooler(int papers, int score, String fullName) {
        this.papers = papers;
        this.score = score;
        this.fullName = fullName;
    }

    public int getPapers() {
        return papers;
    }

    public void setPapers(int papers) {
        this.papers = papers;
    }

    public int getScore() {
        return score;
    }

    public void setScore(int score) {
        this.score = score;
    }

    public String getFullName() {
        return fullName;
    }

    public void setFullName(String fullName) {
        this.fullName = fullName;
    }

    abstract void accept(AwardCheck visitor);

    @Override
    public String toString() {
        return "Schooler{" +
                "papers=" + papers +
                ", score=" + score +
                ", fullName='" + fullName + '\'' +
                '}';
    }

    @Override
    public boolean equals(Object o) {
        if (this == o) return true;
        if (o == null || getClass() != o.getClass()) return false;

        Schooler schooler = (Schooler) o;

        if (papers != schooler.papers) return false;
        if (score != schooler.score) return false;
        return fullName != null ? fullName.equals(schooler.fullName) : schooler.fullName == null;

    }

    @Override
    public int hashCode() {
        int result = papers;
        result = 31 * result + score;
        result = 31 * result + (fullName != null ? fullName.hashCode() : 0);
        return result;
    }
}
